<%@ page import="java.util.Date" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@include file="common/dev_header.jsp"%>
<%
  Date date = new Date();
%>
      <div class="content-wrapper">
        <div class="row user">
          <div class="col-md-12">
            <div class="profile">
              <div class="info"><img class="user-img" src="<%=request.getContextPath()%>/images/gbz.jpg">
                <h4>${devUserInfo.devName}</h4>
                <p>${devUserInfo.devInfo}</p>
              </div>
              <div class="cover-image"></div>
            </div>
          </div>
          <div class="col-md-3">
            <div class="card p-0">
              <ul class="nav nav-tabs nav-stacked user-tabs">
                <li class="active"><a href="#user-timeline" data-toggle="tab">简介</a></li>
                <li><a href="#user-settings" data-toggle="tab">设置</a></li>
              </ul>
            </div>
          </div>
          <div class="col-md-9">
            <div class="tab-content">
              <div class="tab-pane active" id="user-timeline">
                <div class="timeline">
                  <div class="post">
                    <div class="post-media">
                      <div class="content">
                        <h5><a href="#">${devUserInfo.devName}</a></h5>
                        <p class="text-muted"><small><f:formatDate dateStyle="yyyy-MM-dd" value="${date}"/></small></p>
                      </div>
                    </div>
                    <!--个人简介 -->
                    <div class="post-content">
                    	<p>真实姓名：<span id="userNameSpan">${devUserInfo.devName}</span></p>
                    	<p>邮箱：<span id="userEmailSpan">${devUserInfo.devEmail}</span></p>
                        <p>简介：<span id="userInfoSpan">${devUserInfo.devInfo}</span></p>
                    </div>
                    <ul class="post-utility">
                      <li class="likes"><a href="#"><i class="fa fa-fw fa-lg fa-thumbs-o-up"></i>赞</a></li>
                      <li class="shares"><a href="#"><i class="fa fa-fw fa-lg fa-share"></i>分享</a></li>
                      <li class="comments"><i class="fa fa-fw fa-lg fa-comment-o"></i>留言</li>
                    </ul>
                  </div>
                  
                </div>
              </div>
              <div class="tab-pane fade" id="user-settings">
                <div class="card user-settings">
                  <h4 class="line-head">Settings</h4>
                  <!--填写路径-->
                  <form href="<%=request.getContextPath()%>/devuser/update" method="post">
                    <div class="row mb-20">
                      <div class="col-md-4">
                        <label>昵称</label>
                        <input class="form-control" type="text" name="devCode" placeholder="请输入昵称" value="${devUserInfo.devCode}">
                      </div>
                      <div class="col-md-4">
                        <label>真实姓名</label>
                        <input class="form-control" type="text" name="devName" placeholder="请输入姓名" value="${devUserInfo.devName}">
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-md-8 mb-20">
                        <label>邮箱</label>
                        <input class="form-control" type="text" name="devEmail" placeholder="请输入邮箱" value="${devUserInfo.devEmail}">
                      </div>
                      <div class="clearfix"></div>
                      <div class="col-md-8 mb-20">
                        <label>简介</label>
                        <textarea class="form-control" name="devInfo" placeholder="请输入个人简介">${devUserInfo.devInfo}</textarea>
                      </div>
                      <div class="clearfix"></div>
                    </div>
                    <div class="row mb-10">
                      <div class="col-md-12">
                        <input type="hidden" name="id" value="${devUserInfo.id}" />
                        <button class="btn btn-primary" type="button" onclick="javascript:updateDevUser()"><i class="fa fa-fw fa-lg fa-check-circle"></i> 保存</button>
                        &nbsp;&nbsp;<span id="updateMsg"></span>
                        <input type="hidden" name="" value="" />
                      </div>
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script type="text/javascript" charset="utf-8">
      function updateDevUser() {
          var data = $("form").serialize();
          $.post("<%=request.getContextPath()%>/devuser/update",data,function (data) {
              if(data){
                  $("#updateMsg").text("");
                  location.href="<%=request.getContextPath()%>/dev/dev_user.jsp";
              }else{
                  alert(data);
                  $("#updateMsg").text("更新失败，请稍后再试！");
              }
          });
      }
    </script>
  </body>
</html>